/*
 * DxfRAY.java
 *
 * Created on 6 de Dezembro de 2007, 10:54
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package importadorDXF;

import mathematics.Point3D;
import mathematics.Vector3D;

/**
 *
 * @author rafaelbuck
 */
public class DxfRAY extends DxfEntity
{

    public boolean setGroup(short grpNr, float fval)
    {
        switch(grpNr)
        {
        case 10: // '\n'
        case 20: // '\024'
        case 30: // '\036'
            setCoord(startPoint, grpNr / 10, fval);
            return true;

        case 11: // '\013'
        case 21: // '\025'
        case 31: // '\037'
            setCoord(direction, grpNr / 10, fval);
            return true;
        }
        return super.setGroup(grpNr, fval);
    }

    public boolean finishRead(DxfFile file)
    {
        direction.normalize();
        return super.finishRead(file);
    }

    public Point3D getStartPoint()
    {
        return startPoint;
    }

    public Vector3D getDirection()
    {
        return direction;
    }

    /** Creates a new instance of DxfRAY */
    public DxfRAY()
    {
        startPoint = new Point3D();
        direction = new Vector3D();
    }

    private Point3D startPoint;
    private Vector3D direction;
}